const express = require('express');
const router = express.Router();
const userService = require('@/services/userService');
const adminService = require('@/services/adminService');

const validateChecks = require('@/middlewares/validatorPayload');
const { check, param } = require('express-validator');



router.post('/login', validateChecks([
    check('password', '密码不能为空或长度不能低于5位').isLength({ min: 5 }),
    check('phone', '手机号不能为空或电话格式不对').isMobilePhone()
]), async function (req, res, next) {
    try {
        const { phone , password  } = req.body;
        const data = await userService.veryLogin({phone,password});
        res.createResponse(200, '登录成功！', data)
    } catch (err) {
        res.createResponse(500, err.message);
    }
});


router.post('/loginOut', validateChecks([
]), async function (req, res, next) {
    try {
        res.createResponse(200, '退出成功！')
    } catch (err) {
        res.createResponse(500, err.message);
    }
});


router.get('/code', validateChecks([
   
]), async function (req, res, next) {
    try {
        res.createResponse(200, "操作成功",
            { 
            "img": "/9j/4AAQSkZJRgABAgAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAA8AKADASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvA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Df8AxVR3PjPUbq1mt3htQkqMjFVbIBGOPmqZVo2YpVY2Z//Z",
            "code": 200,
            "captchaEnabled": true,
            "uuid": "d6da66ba4124450c89d0f9536c13f69d"
        });
    } catch (err) {
        res.createResponse(500, err.message);
    }
});


router.get('/getUserInfo', validateChecks([
    
]), async function (req, res, next) {
    try {
        // const { phone , password  } = req.body;
        // const data = await userService.veryLogin({phone,password});
        res.createResponse(200, '"操作成功"', {"permissions": [
        "*:*:*"
    ],
    "roles": [
        "admin"
    ],
    "user": {
        "createBy": "admin",
        "createTime": "2024-06-30 11:27:11",
        "updateBy": null,
        "updateTime": null,
        "remark": "管理员",
        "userId": 1,
        "deptId": 103,
        "userName": "admin",
        "nickName": "若依",
        "email": "ry@163.com",
        "phonenumber": "15888888888",
        "sex": "1",
        "avatar": "",
        "password": "$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2",
        "status": "0",
        "delFlag": "0",
        "loginIp": "111.172.58.6",
        "loginDate": "2024-07-31T21:21:21.000+08:00",
        "dept": {
            "createBy": null,
            "createTime": null,
            "updateBy": null,
            "updateTime": null,
            "remark": null,
            "deptId": 103,
            "parentId": 101,
            "ancestors": "0,100,101",
            "deptName": "研发部门",
            "orderNum": 1,
            "leader": "若依",
            "phone": null,
            "email": null,
            "status": "0",
            "delFlag": null,
            "parentName": null,
            "children": []
        },
        "roles": [
            {
                "createBy": null,
                "createTime": null,
                "updateBy": null,
                "updateTime": null,
                "remark": null,
                "roleId": 1,
                "roleName": "超级管理员",
                "roleKey": "admin",
                "roleSort": 1,
                "dataScope": "1",
                "menuCheckStrictly": false,
                "deptCheckStrictly": false,
                "status": "0",
                "delFlag": null,
                "flag": false,
                "menuIds": null,
                "deptIds": null,
                "permissions": null,
                "admin": true
            }
        ],
        "roleIds": null,
        "postIds": null,
        "roleId": null,
        "admin": true
    }})
    } catch (err) {
        res.createResponse(500, err.message);
    }
});


router.get('/getUserRouters', validateChecks([
    
]), async function (req, res, next) {
    try {
        // const { phone , password  } = req.body;
        // const data = await userService.veryLogin({phone,password});
        res.createResponse(200, '"操作成功"', [
            {
                "name": "System",
                "path": "/system",
                "hidden": false,
                "redirect": "noRedirect",
                "component": "Layout",
                "alwaysShow": true,
                "meta": {
                    "title": "系统管理",
                    "icon": "system",
                    "noCache": false,
                    "link": null
                },
                "children": [
                    {
                        "name": "User",
                        "path": "user",
                        "hidden": false,
                        "component": "system/user/index",
                        "meta": {
                            "title": "用户管理",
                            "icon": "user",
                            "noCache": false,
                            "link": null
                        }
                    },
                    {
                        "name": "Role",
                        "path": "role",
                        "hidden": false,
                        "component": "system/role/index",
                        "meta": {
                            "title": "角色管理",
                            "icon": "peoples",
                            "noCache": false,
                            "link": null
                        }
                    },
                    {
                        "name": "Menu",
                        "path": "menu",
                        "hidden": false,
                        "component": "system/menu/index",
                        "meta": {
                            "title": "菜单管理",
                            "icon": "tree-table",
                            "noCache": false,
                            "link": null
                        }
                    },
                    {
                        "name": "Dept",
                        "path": "dept",
                        "hidden": false,
                        "component": "system/dept/index",
                        "meta": {
                            "title": "部门管理",
                            "icon": "tree",
                            "noCache": false,
                            "link": null
                        }
                    },
                    {
                        "name": "Post",
                        "path": "post",
                        "hidden": false,
                        "component": "system/post/index",
                        "meta": {
                            "title": "岗位管理",
                            "icon": "post",
                            "noCache": false,
                            "link": null
                        }
                    },
                    {
                        "name": "Dict",
                        "path": "dict",
                        "hidden": false,
                        "component": "system/dict/index",
                        "meta": {
                            "title": "字典管理",
                            "icon": "dict",
                            "noCache": false,
                            "link": null
                        }
                    },
                    {
                        "name": "Config",
                        "path": "config",
                        "hidden": false,
                        "component": "system/config/index",
                        "meta": {
                            "title": "参数设置",
                            "icon": "edit",
                            "noCache": false,
                            "link": null
                        }
                    },
                    {
                        "name": "Notice",
                        "path": "notice",
                        "hidden": false,
                        "component": "system/notice/index",
                        "meta": {
                            "title": "通知公告",
                            "icon": "message",
                            "noCache": false,
                            "link": null
                        }
                    },
                    {
                        "name": "Log",
                        "path": "log",
                        "hidden": false,
                        "redirect": "noRedirect",
                        "component": "ParentView",
                        "alwaysShow": true,
                        "meta": {
                            "title": "日志管理",
                            "icon": "log",
                            "noCache": false,
                            "link": null
                        },
                        "children": [
                            {
                                "name": "Operlog",
                                "path": "operlog",
                                "hidden": false,
                                "component": "system/operlog/index",
                                "meta": {
                                    "title": "操作日志",
                                    "icon": "form",
                                    "noCache": false,
                                    "link": null
                                }
                            },
                            {
                                "name": "Logininfor",
                                "path": "logininfor",
                                "hidden": false,
                                "component": "system/logininfor/index",
                                "meta": {
                                    "title": "登录日志",
                                    "icon": "logininfor",
                                    "noCache": false,
                                    "link": null
                                }
                            }
                        ]
                    }
                ]
            },
            {
                "name": "Monitor",
                "path": "/monitor",
                "hidden": false,
                "redirect": "noRedirect",
                "component": "Layout",
                "alwaysShow": true,
                "meta": {
                    "title": "系统监控",
                    "icon": "monitor",
                    "noCache": false,
                    "link": null
                },
                "children": [
                    {
                        "name": "Online",
                        "path": "online",
                        "hidden": false,
                        "component": "monitor/online/index",
                        "meta": {
                            "title": "在线用户",
                            "icon": "online",
                            "noCache": false,
                            "link": null
                        }
                    },
                    {
                        "name": "Job",
                        "path": "job",
                        "hidden": false,
                        "component": "monitor/job/index",
                        "meta": {
                            "title": "定时任务",
                            "icon": "job",
                            "noCache": false,
                            "link": null
                        }
                    },
                    {
                        "name": "Druid",
                        "path": "druid",
                        "hidden": false,
                        "component": "monitor/druid/index",
                        "meta": {
                            "title": "数据监控",
                            "icon": "druid",
                            "noCache": false,
                            "link": null
                        }
                    },
                    {
                        "name": "Server",
                        "path": "server",
                        "hidden": false,
                        "component": "monitor/server/index",
                        "meta": {
                            "title": "服务监控",
                            "icon": "server",
                            "noCache": false,
                            "link": null
                        }
                    },
                    {
                        "name": "Cache",
                        "path": "cache",
                        "hidden": false,
                        "component": "monitor/cache/index",
                        "meta": {
                            "title": "缓存监控",
                            "icon": "redis",
                            "noCache": false,
                            "link": null
                        }
                    },
                    {
                        "name": "CacheList",
                        "path": "cacheList",
                        "hidden": false,
                        "component": "monitor/cache/list",
                        "meta": {
                            "title": "缓存列表",
                            "icon": "redis-list",
                            "noCache": false,
                            "link": null
                        }
                    }
                ]
            },
            {
                "name": "Tool",
                "path": "/tool",
                "hidden": false,
                "redirect": "noRedirect",
                "component": "Layout",
                "alwaysShow": true,
                "meta": {
                    "title": "系统工具",
                    "icon": "tool",
                    "noCache": false,
                    "link": null
                },
                "children": [
                    {
                        "name": "Build",
                        "path": "build",
                        "hidden": false,
                        "component": "tool/build/index",
                        "meta": {
                            "title": "表单构建",
                            "icon": "build",
                            "noCache": false,
                            "link": null
                        }
                    },
                    {
                        "name": "Gen",
                        "path": "gen",
                        "hidden": false,
                        "component": "tool/gen/index",
                        "meta": {
                            "title": "代码生成",
                            "icon": "code",
                            "noCache": false,
                            "link": null
                        }
                    },
                    {
                        "name": "Swagger",
                        "path": "swagger",
                        "hidden": false,
                        "component": "tool/swagger/index",
                        "meta": {
                            "title": "系统接口",
                            "icon": "swagger",
                            "noCache": false,
                            "link": null
                        }
                    }
                ]
            },
            {
                "name": "http://laofuzi.fun/hello",
                "path": "http://laofuzi.fun/hello",
                "hidden": false,
                "component": "Layout",
                "meta": {
                    "title": "官网",
                    "icon": "guide",
                    "noCache": false,
                    "link": "http://laofuzi.fun/hello"
                }
            }
        ])
    } catch (err) {
        res.createResponse(500, err.message);
    }
});


router.get('/userListQuery', validateChecks([
    
]), async function (req, res, next) {
    try {
      
        res.createResponse(200, '查询成功', {
            "total": 2,
            "rows": [
                {
                    "createBy": "admin",
                    "createTime": "2024-06-30 11:27:11",
                    "updateBy": null,
                    "updateTime": null,
                    "remark": "管理员",
                    "userId": 1,
                    "deptId": 103,
                    "userName": "admin",
                    "nickName": "若依",
                    "email": "ry@163.com",
                    "phonenumber": "15888888888",
                    "sex": "1",
                    "avatar": "",
                    "password": null,
                    "status": "0",
                    "delFlag": "0",
                    "loginIp": "111.201.149.106",
                    "loginDate": "2024-08-01T04:18:38.000+08:00",
                    "dept": {
                        "createBy": null,
                        "createTime": null,
                        "updateBy": null,
                        "updateTime": null,
                        "remark": null,
                        "deptId": 103,
                        "parentId": null,
                        "ancestors": null,
                        "deptName": "研发部门",
                        "orderNum": null,
                        "leader": "若依",
                        "phone": null,
                        "email": null,
                        "status": null,
                        "delFlag": null,
                        "parentName": null,
                        "children": []
                    },
                    "roles": [],
                    "roleIds": null,
                    "postIds": null,
                    "roleId": null,
                    "admin": true
                },
                {
                    "createBy": "admin",
                    "createTime": "2024-06-30 11:27:11",
                    "updateBy": null,
                    "updateTime": null,
                    "remark": "测试员",
                    "userId": 2,
                    "deptId": 105,
                    "userName": "ry",
                    "nickName": "若依",
                    "email": "ry@qq.com",
                    "phonenumber": "15666666666",
                    "sex": "1",
                    "avatar": "",
                    "password": null,
                    "status": "0",
                    "delFlag": "0",
                    "loginIp": "110.249.128.123",
                    "loginDate": "2024-07-31T17:15:07.000+08:00",
                    "dept": {
                        "createBy": null,
                        "createTime": null,
                        "updateBy": null,
                        "updateTime": null,
                        "remark": null,
                        "deptId": 105,
                        "parentId": null,
                        "ancestors": null,
                        "deptName": "测试部门",
                        "orderNum": null,
                        "leader": "若依",
                        "phone": null,
                        "email": null,
                        "status": null,
                        "delFlag": null,
                        "parentName": null,
                        "children": []
                    },
                    "roles": [],
                    "roleIds": null,
                    "postIds": null,
                    "roleId": null,
                    "admin": false
                }
            ],
            "code": 200,
            "msg": "查询成功"
        })
    } catch (err) {
        res.createResponse(500, err.message);
    }
});



router.get('/deptTreeQuery', validateChecks([
   
]), async function (req, res, next) {
   
    try {
        res.createResponse(200, '操作成功',[
            {
                "id": 100,
                "label": "若依科技",
                "children": [
                    {
                        "id": 101,
                        "label": "深圳总公司",
                        "children": [
                            {
                                "id": 103,
                                "label": "研发部门"
                            },
                            {
                                "id": 104,
                                "label": "市场部门"
                            },
                            {
                                "id": 105,
                                "label": "测试部门"
                            },
                            {
                                "id": 106,
                                "label": "财务部门"
                            },
                            {
                                "id": 107,
                                "label": "运维部门"
                            }
                        ]
                    },
                    {
                        "id": 102,
                        "label": "长沙分公司",
                        "children": [
                            {
                                "id": 108,
                                "label": "市场部门"
                            },
                            {
                                "id": 109,
                                "label": "财务部门"
                            }
                        ]
                    }
                ]
            }
        ]);
    } catch (err) {
        res.createResponse(500, err.message);
    }
});


/***
 * 角色管理-列表查询
 */
router.get('/roleListQuery', validateChecks([
   
]), async function (req, res, next) {
    try {
        let data = await adminService.getRoleList(req.query);
        res.createResponse(200, '操作成功',data);
    } catch (err) {
        res.createResponse(500, err.message);
    }
});



/***
 * 角色管理-新增
 */
router.post('/addRole', validateChecks([
    check('roleName', '角色名称').notEmpty(),
    check('roleKey', '权限字符').notEmpty(),
    check('roleSort', '角色顺序').notEmpty(),
]), async function (req, res, next) {
    try {
        let data = await adminService.addRole(req.body);
        res.createResponse(200, '操作成功',data);
    } catch (err) {
        res.createResponse(500, err.message);
    }
});


/***
 * 角色管理-查询详情
 */
router.get('/getRole/:id', validateChecks([
]), async function (req, res, next) {
    try {
        let data = await adminService.getRole(req.params.id);
        res.createResponse(200, '操作成功',data);
    } catch (err) {
        res.createResponse(500, err.message);
    }
});


/***
 * 角色管理-修改
 */
router.put('/updateRole', validateChecks([
]), async function (req, res, next) {
    try {
        let data = await adminService.updateRole(req.body);
        res.createResponse(200, '操作成功');
    } catch (err) {
        res.createResponse(500, err.message);
    }
});




/***
 * 角色管理-删除
 */
router.delete('/delRole/:id', validateChecks([
]), async function (req, res, next) {
    try {
        let data = await adminService.delRole(req.params.id);
        res.createResponse(200, '操作成功');
    } catch (err) {
        res.createResponse(500, err.message);
    }
});

/***
 * 角色管理-状态修改
 */
router.put('/changeRoleStatus', validateChecks([
]), async function (req, res, next) {
    try {
        let data = await adminService.updateRoleStatus(req.body);
        res.createResponse(200, '操作成功');
    } catch (err) {
        res.createResponse(500, err.message);
    }
});


/***
 * 角色管理-查询菜单下拉树结构
 */
router.get('/menuTreeSelect', validateChecks([
   
]), async function (req, res, next) {
    try {
        let data = await adminService.menuTreeSelect();
        res.createResponse(200, '操作成功',data);
    } catch (err) {
        res.createResponse(500, err.message);
    }
});


/***
 * 角色管理-根据角色ID查询菜单树结构
 */
router.get('/menuRoleMenuTreeselect/:id', validateChecks([
]), async function (req, res, next) {
    try {
        let data = await adminService.menuRoleMenuTreeselect(req.params);
        res.createResponse(200, '操作成功', data);
    } catch (err) {
        res.createResponse(500, err.message);
    }
});


/***
 * 角色管理-根据角色ID查询部门树结构
 */
router.get('/roleDeptTree/:id', validateChecks([
]), async function (req, res, next) {
    try {
        let data = await adminService.roleDeptTree(req.params);
        res.createResponse(200, '操作成功', data);
    } catch (err) {
        res.createResponse(500, err.message);
    }
});      


/***
 * 角色管理-分配角色数据权限
 */
router.put('/roleDataScope', validateChecks([
]), async function (req, res, next) {
    try {
        let data = await adminService.roleDataScope(req.body);
        res.createResponse(200, '操作成功');
    } catch (err) {
        res.createResponse(500, err.message);
    }
});



/***
 * 角色管理-查询角色已授权用户列表
 */
router.put('/roleDataScope', validateChecks([
]), async function (req, res, next) {
    try {
        let data = await adminService.roleDataScope(req.body);
        res.createResponse(200, '操作成功');
    } catch (err) {
        res.createResponse(500, err.message);
    }
});


/***
 * 角色管理-查询角色已授权用户列表
 */
router.get('/roleAuthUserAllocatedList', validateChecks([
   
]), async function (req, res, next) {
    try {
        let data = await adminService.roleAuthUserAllocatedListQuery();
        res.createResponse(200, '操作成功',data);
    } catch (err) {
        res.createResponse(500, err.message);
    }
});




router.post('/test', validateChecks([
    check('code', '验证码不能为空').notEmpty(),
    check('email', '邮箱不能为空').notEmpty(),
]), async function (req, res, next) {
   
    try {
        await userService.verify(req.body);
        res.createResponse(200, '用户激活成功');
    } catch (err) {
        res.createResponse(500, err.message);
    }
});


/***
 * 菜单管理-菜单列表查询
 */
router.get('/menuListQuery', validateChecks([
  
]), async function (req, res, next) {
    try {
        let data = await adminService.getMenuList(req.query);
        res.createResponse(200, '操作成功',data);
    } catch (err) {
        res.createResponse(500, err.message);
    }
});



/***
 * 菜单管理-新增
 */
router.post('/addMenu', validateChecks([
    check('menuName', '菜单名称').notEmpty(),
    check('status', '状态').notEmpty(),
]), async function (req, res, next) {
    try {
        let data = await adminService.addMenu(req.body);
        res.createResponse(200, '操作成功',data);
    } catch (err) {
        res.createResponse(500, err.message);
    }
});


/***
 * 菜单管理-查询详情
 */
router.get('/getMenu/:id', validateChecks([
]), async function (req, res, next) {
    try {
        let data = await adminService.getMenu(req.params.id);
        res.createResponse(200, '操作成功',data);
    } catch (err) {
        res.createResponse(500, err.message);
    }
});


/***
 * 菜单管理-修改
 */
router.put('/updateMenu', validateChecks([
]), async function (req, res, next) {
    try {
        let data = await adminService.updateMenu(req.body);
        res.createResponse(200, '操作成功');
    } catch (err) {
        res.createResponse(500, err.message);
    }
});


/***
 * 菜单管理-删除
 */
router.delete('/delMenu/:id', validateChecks([
]), async function (req, res, next) {
    try {
        let data = await adminService.delMenu(req.params.id);
        res.createResponse(200, '操作成功');
    } catch (err) {
        res.createResponse(500, err.message);
    }
});



router.get('/dictDataTypeQuery/:dataTypeName', validateChecks([
  
]), async function (req, res, next) {
   
    try {
        let data = await adminService.dictDataTypeQuery(req.params.dataTypeName);
        res.createResponse(200, '操作成功', data);
    } catch (err) {
        res.createResponse(500, err.message);
    }
});



router.get('/getConfigKey/:keyName', validateChecks([
  
]), async function (req, res, next) {
   
    try {
        res.createResponse(200, '操作成功',[]);
    } catch (err) {
        res.createResponse(500, err.message);
    }
});


/***
 * 部门管理-查询列表
 */
router.get('/deptListQuery', validateChecks([
   
]), async function (req, res, next) {
    try {
        let data = await adminService.getDeptList(req.query);
        res.createResponse(200, '操作成功',data);
    } catch (err) {
        res.createResponse(500, err.message);
    }
});

/***
 * 部门管理-新增部门列表
 */
router.post('/addDept', validateChecks([
    check('parentId', '上级部门').notEmpty(),
    check('deptName', '部门名称').notEmpty(),
    check('orderNum', '显示排序').notEmpty(),
]), async function (req, res, next) {
    try {
        let data = await adminService.addDept(req.body);
        res.createResponse(200, '操作成功',data);
    } catch (err) {
        res.createResponse(500, err.message);
    }
});

/***
 * 部门管理-查询部门详情
 */
router.get('/getDept/:id', validateChecks([
    // param('page').notEmpty(),
]), async function (req, res, next) {
    try {
        let data = await adminService.getDept(req.params.id);
        res.createResponse(200, '操作成功',data);
    } catch (err) {
        res.createResponse(500, err.message);
    }
});


/***
 * 部门管理-查询部门列表（排除节点）
 */
router.get('/deptListExclude/:id', validateChecks([
    // param('page').notEmpty(),
]), async function (req, res, next) {
    try {
        let data = await adminService.deptListExclude(req.query.id);
        res.createResponse(200, '操作成功',data);
    } catch (err) {
        res.createResponse(500, err.message);
    }
});


/***
 * 部门管理-修改部门
 */
router.put('/updateDept', validateChecks([
    // param('page').notEmpty(),
]), async function (req, res, next) {
    try {
        let data = await adminService.updateDept(req.body);
        res.createResponse(200, '操作成功');
    } catch (err) {
        res.createResponse(500, err.message);
    }
});


/***
 * 部门管理-删除部门
 */
router.delete('/delDept/:id', validateChecks([
]), async function (req, res, next) {
    try {
        let data = await adminService.delDept(req.params.id);
        res.createResponse(200, '操作成功');
    } catch (err) {
        res.createResponse(500, err.message);
    }
});


/***
 * 岗位管理-查询列表
 */
router.get('/postListQuery', validateChecks([
  
]), async function (req, res, next) {
   
    try {
        let data = await adminService.getPostList(req.query);
        res.createResponse(200, '操作成功',data);
    } catch (err) {
        res.createResponse(500, err.message);
    }
});


/***
 * 岗位管理-新增岗位
 */
router.post('/addPost', validateChecks([
    check('postName', '岗位名称').notEmpty(),
    check('postCode', '岗位编码').notEmpty(),
    check('postSort', '岗位顺序').notEmpty(),
]), async function (req, res, next) {
    try {
        let data = await adminService.addPost(req.body);
        res.createResponse(200, '操作成功',data);
    } catch (err) {
        res.createResponse(500, err.message);
    }
});


/***
 * 岗位管理-查询部门详情
 */
router.get('/getPost/:id', validateChecks([
]), async function (req, res, next) {
    try {
        let data = await adminService.getPost(req.params.id);
        res.createResponse(200, '操作成功',data);
    } catch (err) {
        res.createResponse(500, err.message);
    }
});


/***
 * 岗位管理-修改岗位
 */
router.put('/updatePost', validateChecks([
]), async function (req, res, next) {
    try {
        let data = await adminService.updatePost(req.body);
        res.createResponse(200, '操作成功');
    } catch (err) {
        res.createResponse(500, err.message);
    }
});


/***
 * 岗位管理-删除岗位
 */
router.delete('/delPost/:id', validateChecks([
]), async function (req, res, next) {
    try {
        let data = await adminService.delPost(req.params.id);
        res.createResponse(200, '操作成功');
    } catch (err) {
        res.createResponse(500, err.message);
    }
});


/***
 * 字典类型管理-查询列表
 */
router.get('/dictTypeListQuery', validateChecks([
  
]), async function (req, res, next) {
   
    try {
        let data = await adminService.getDictTypeList(req.query);
        res.createResponse(200, '操作成功',data);
    } catch (err) {
        res.createResponse(500, err.message);
    }
});


/***
 * 字典类型管理-新增
 */
router.post('/addDictType', validateChecks([
    check('dictName', '字典名称').notEmpty(),
    check('dictType', '字典类型').notEmpty(),
]), async function (req, res, next) {
    try {
        let data = await adminService.addDictType(req.body);
        res.createResponse(200, '操作成功',data);
    } catch (err) {
        res.createResponse(500, err.message);
    }
});


/***
 * 字典类型管理-查询详情
 */
router.get('/getDictType/:id', validateChecks([
]), async function (req, res, next) {
    try {
        let data = await adminService.getDictType(req.params.id);
        res.createResponse(200, '操作成功',data);
    } catch (err) {
        res.createResponse(500, err.message);
    }
});


/***
 * 字典类型管理-修改
 */
router.put('/updateDictType', validateChecks([
]), async function (req, res, next) {
    try {
        let data = await adminService.updateDictType(req.body);
        res.createResponse(200, '操作成功');
    } catch (err) {
        res.createResponse(500, err.message);
    }
});


/***
 * 字典类型管理-删除
 */
router.delete('/delDictType/:id', validateChecks([
]), async function (req, res, next) {
    try {
        let data = await adminService.delDictType(req.params.id);
        res.createResponse(200, '操作成功');
    } catch (err) {
        res.createResponse(500, err.message);
    }
});




/***
 * 字典管理-获取字典选择框列表
 */
router.get('/dictTypeOptionSelect', validateChecks([
]), async function (req, res, next) {
    try {
        let data = await adminService.getDictTypeList();
        res.createResponse(200, '操作成功',data.rows);
    } catch (err) {
        res.createResponse(500, err.message);
    }
});
/***
 * 公告管理-获取列表
 */


router.get('/noticeListQuery', validateChecks([
  
]), async function (req, res, next) {
   
    try {
        let data = await adminService.getNoticeList(req.query);
        res.createResponse(200, '操作成功',data);
    } catch (err) {
        res.createResponse(500, err.message);
    }
});




/***
 * 字典数据管理-查询列表
 */
router.get('/dictDataListQuery', validateChecks([
  
]), async function (req, res, next) {
   
    try {
        let data = await adminService.getDictDataList(req.query);
        res.createResponse(200, '操作成功',data);
    } catch (err) {
        res.createResponse(500, err.message);
    }
});


/***
 * 字典数据管理-新增
 */
router.post('/addDictData', validateChecks([
    check('dictLabel', '数据标签').notEmpty(),
    check('dictValue', '数据键值').notEmpty(),
    check('dictSort', '显示排序').notEmpty(),
]), async function (req, res, next) {
    try {
        let data = await adminService.addDictData(req.body);
        res.createResponse(200, '操作成功',data);
    } catch (err) {
        res.createResponse(500, err.message);
    }
});


/***
 * 字典数据管理-查询详情
 */
router.get('/getDictData/:id', validateChecks([
]), async function (req, res, next) {
    try {
        let data = await adminService.getDictData(req.params.id);
        res.createResponse(200, '操作成功',data);
    } catch (err) {
        res.createResponse(500, err.message);
    }
});


/***
 * 字典数据管理-修改
 */
router.put('/updateDictData', validateChecks([
]), async function (req, res, next) {
    try {
        let data = await adminService.updateDictData(req.body);
        res.createResponse(200, '操作成功');
    } catch (err) {
        res.createResponse(500, err.message);
    }
});


/***
 * 字典数据管理-删除
 */
router.delete('/delDictData/:id', validateChecks([
]), async function (req, res, next) {
    try {
        let data = await adminService.delDictData(req.params.id);
        res.createResponse(200, '操作成功');
    } catch (err) {
        res.createResponse(500, err.message);
    }
});



/***
 * 参数管理-列表查询
 */
router.get('/configListQuery', validateChecks([
  
]), async function (req, res, next) {
   
    try {
        let data = await adminService.getconfigList(req.query);
        res.createResponse(200, '操作成功',data);
    } catch (err) {
        res.createResponse(500, err.message);
    }
});


/***
 * 参数管理-新增
 */
router.post('/addConfig', validateChecks([
    check('configName', '参数名称').notEmpty(),
    check('configKey', '参数键名').notEmpty(),
    check('configValue', '参数键值').notEmpty(),
]), async function (req, res, next) {
    try {
        let data = await adminService.addConfig(req.body);
        res.createResponse(200, '操作成功',data);
    } catch (err) {
        res.createResponse(500, err.message);
    }
});


/***
 * 参数管理-查询详情
 */
router.get('/getConfig/:id', validateChecks([
]), async function (req, res, next) {
    try {
        let data = await adminService.getConfig(req.params.id);
        res.createResponse(200, '操作成功',data);
    } catch (err) {
        res.createResponse(500, err.message);
    }
});


/***
 * 参数管理-修改
 */
router.put('/updateConfig', validateChecks([
]), async function (req, res, next) {
    try {
        let data = await adminService.updateConfig(req.body);
        res.createResponse(200, '操作成功');
    } catch (err) {
        res.createResponse(500, err.message);
    }
});


/***
 * 参数管理-删除
 */
router.delete('/delConfig/:id', validateChecks([
]), async function (req, res, next) {
    try {
        let data = await adminService.delConfig(req.params.id);
        res.createResponse(200, '操作成功');
    } catch (err) {
        res.createResponse(500, err.message);
    }
});



router.get('/operlogListQuery', validateChecks([
  
]), async function (req, res, next) {
   
    try {
        res.createResponse(200, '操作成功',{
            "total": 4416,
            "rows": [
                {
                    "createBy": null,
                    "createTime": null,
                    "updateBy": null,
                    "updateTime": null,
                    "remark": null,
                    "operId": 4515,
                    "title": "代码生成",
                    "businessType": 3,
                    "businessTypes": null,
                    "method": "com.ruoyi.project.tool.gen.controller.GenController.remove()",
                    "requestMethod": "DELETE",
                    "operatorType": 1,
                    "operName": "admin",
                    "deptName": "研发部门",
                    "operUrl": "/tool/gen/546",
                    "operIp": "220.200.127.105",
                    "operLocation": "广西 南宁市",
                    "operParam": "{}",
                    "jsonResult": "{\"msg\":\"操作成功\",\"code\":200}",
                    "status": 0,
                    "errorMsg": null,
                    "operTime": "2024-08-02 20:42:23",
                    "costTime": 6
                },
                {
                    "createBy": null,
                    "createTime": null,
                    "updateBy": null,
                    "updateTime": null,
                    "remark": null,
                    "operId": 4514,
                    "title": "代码生成",
                    "businessType": 8,
                    "businessTypes": null,
                    "method": "com.ruoyi.project.tool.gen.controller.GenController.batchGenCode()",
                    "requestMethod": "GET",
                    "operatorType": 1,
                    "operName": "admin",
                    "deptName": "研发部门",
                    "operUrl": "/tool/gen/batchGenCode",
                    "operIp": "220.200.127.105",
                    "operLocation": "广西 南宁市",
                    "operParam": "{\"tables\":\"sys_dept\"}",
                    "jsonResult": null,
                    "status": 0,
                    "errorMsg": null,
                    "operTime": "2024-08-02 20:40:41",
                    "costTime": 20
                },
                {
                    "createBy": null,
                    "createTime": null,
                    "updateBy": null,
                    "updateTime": null,
                    "remark": null,
                    "operId": 4513,
                    "title": "代码生成",
                    "businessType": 6,
                    "businessTypes": null,
                    "method": "com.ruoyi.project.tool.gen.controller.GenController.importTableSave()",
                    "requestMethod": "POST",
                    "operatorType": 1,
                    "operName": "admin",
                    "deptName": "研发部门",
                    "operUrl": "/tool/gen/importTable",
                    "operIp": "211.143.181.232",
                    "operLocation": "福建省 福州市",
                    "operParam": "{\"tables\":\"sys_menu\"}",
                    "jsonResult": "{\"msg\":\"操作成功\",\"code\":200}",
                    "status": 0,
                    "errorMsg": null,
                    "operTime": "2024-08-02 20:38:20",
                    "costTime": 29
                },
                {
                    "createBy": null,
                    "createTime": null,
                    "updateBy": null,
                    "updateTime": null,
                    "remark": null,
                    "operId": 4512,
                    "title": "代码生成",
                    "businessType": 2,
                    "businessTypes": null,
                    "method": "com.ruoyi.project.tool.gen.controller.GenController.editSave()",
                    "requestMethod": "PUT",
                    "operatorType": 1,
                    "operName": "admin",
                    "deptName": "研发部门",
                    "operUrl": "/tool/gen",
                    "operIp": "39.154.5.10",
                    "operLocation": "内蒙古 呼和浩特市",
                    "operParam": "{\"businessName\":\"dept\",\"className\":\"SysDept\",\"columns\":[{\"capJavaField\":\"DeptId\",\"columnComment\":\"部门id\",\"columnId\":5639,\"columnName\":\"dept_id\",\"columnType\":\"bigint(20)\",\"createBy\":\"admin\",\"createTime\":\"2024-08-02 13:13:32\",\"dictType\":\"\",\"edit\":false,\"htmlType\":\"input\",\"increment\":true,\"insert\":true,\"isEdit\":\"0\",\"isIncrement\":\"1\",\"isInsert\":\"1\",\"isPk\":\"1\",\"isRequired\":\"0\",\"javaField\":\"deptId\",\"javaType\":\"Long\",\"list\":false,\"params\":{},\"pk\":true,\"query\":false,\"queryType\":\"EQ\",\"required\":false,\"sort\":1,\"superColumn\":false,\"tableId\":544,\"updateBy\":\"\",\"updateTime\":\"2024-08-02 17:56:53\",\"usableColumn\":false},{\"capJavaField\":\"ParentId\",\"columnComment\":\"父部门id\",\"columnId\":5640,\"columnName\":\"parent_id\",\"columnType\":\"bigint(20)\",\"createBy\":\"admin\",\"createTime\":\"2024-08-02 13:13:32\",\"dictType\":\"\",\"edit\":true,\"htmlType\":\"input\",\"increment\":false,\"insert\":true,\"isEdit\":\"1\",\"isIncrement\":\"0\",\"isInsert\":\"1\",\"isList\":\"1\",\"isPk\":\"0\",\"isQuery\":\"1\",\"isRequired\":\"0\",\"javaField\":\"parentId\",\"javaType\":\"Long\",\"list\":true,\"params\":{},\"pk\":false,\"query\":true,\"queryType\":\"EQ\",\"required\":false,\"sort\":2,\"superColumn\":true,\"tableId\":544,\"updateBy\":\"\",\"updateTime\":\"2024-08-02 17:56:53\",\"usableColumn\":true},{\"capJavaField\":\"Ancestors\",\"columnComment\":\"祖级列表\",\"columnId\":5641,\"columnName\":\"ancestors\",\"columnType\":\"varchar(50)\",\"createBy\":\"admin\",\"createTime\":\"2024-08-02 13:13:32\",\"dictType\":\"\",\"edit\":true,\"htmlType\":\"input\",\"increment\":false,\"insert\":true,\"isEdit\":\"1\",\"isIncrement\":\"0\",\"isInsert\":\"1\",\"isList\":\"1\",\"isPk\":\"0\",\"isQuery\":\"1\",\"isRequired\":\"0\",\"javaField\":\"ancestors\",\"javaType\":\"String\",\"list\":true,\"params\":{},\"pk\":false,\"query\":true,\"queryType\":\"GT\",\"required\":false,\"sort\":3,\"superColumn\":true,\"tableId\":544,\"updateBy\":\"\",\"updateTime\":\"2024-08-02 17:56:53\",\"usableColumn\":false},{\"capJavaField\":\"DeptName\",\"columnComment\":\"部门名称\",\"columnId\":5642,\"columnName\":\"dept_name\",\"columnType\":\"varchar(30)\",\"createBy\":\"admin\",\"createTime\":\"2024-08-02 13:13:32\",\"dictType\":\"\",\"edit\":true,\"htmlType\":\"input",
                    "jsonResult": "{\"msg\":\"操作成功\",\"code\":200}",
                    "status": 0,
                    "errorMsg": null,
                    "operTime": "2024-08-02 20:26:22",
                    "costTime": 18
                },
                {
                    "createBy": null,
                    "createTime": null,
                    "updateBy": null,
                    "updateTime": null,
                    "remark": null,
                    "operId": 4511,
                    "title": "代码生成",
                    "businessType": 8,
                    "businessTypes": null,
                    "method": "com.ruoyi.project.tool.gen.controller.GenController.batchGenCode()",
                    "requestMethod": "GET",
                    "operatorType": 1,
                    "operName": "admin",
                    "deptName": "研发部门",
                    "operUrl": "/tool/gen/batchGenCode",
                    "operIp": "39.154.5.10",
                    "operLocation": "内蒙古 呼和浩特市",
                    "operParam": "{\"tables\":\"sys_dept\"}",
                    "jsonResult": null,
                    "status": 0,
                    "errorMsg": null,
                    "operTime": "2024-08-02 20:26:09",
                    "costTime": 24
                },
                {
                    "createBy": null,
                    "createTime": null,
                    "updateBy": null,
                    "updateTime": null,
                    "remark": null,
                    "operId": 4510,
                    "title": "代码生成",
                    "businessType": 8,
                    "businessTypes": null,
                    "method": "com.ruoyi.project.tool.gen.controller.GenController.batchGenCode()",
                    "requestMethod": "GET",
                    "operatorType": 1,
                    "operName": "admin",
                    "deptName": "研发部门",
                    "operUrl": "/tool/gen/batchGenCode",
                    "operIp": "112.96.55.177",
                    "operLocation": "广东省 广州市",
                    "operParam": "{\"tables\":\"sys_dept\"}",
                    "jsonResult": null,
                    "status": 0,
                    "errorMsg": null,
                    "operTime": "2024-08-02 20:04:10",
                    "costTime": 32
                },
                {
                    "createBy": null,
                    "createTime": null,
                    "updateBy": null,
                    "updateTime": null,
                    "remark": null,
                    "operId": 4509,
                    "title": "代码生成",
                    "businessType": 8,
                    "businessTypes": null,
                    "method": "com.ruoyi.project.tool.gen.controller.GenController.batchGenCode()",
                    "requestMethod": "GET",
                    "operatorType": 1,
                    "operName": "admin",
                    "deptName": "研发部门",
                    "operUrl": "/tool/gen/batchGenCode",
                    "operIp": "116.21.12.193",
                    "operLocation": "广东省 广州市",
                    "operParam": "{\"tables\":\"sys_dept\"}",
                    "jsonResult": null,
                    "status": 0,
                    "errorMsg": null,
                    "operTime": "2024-08-02 19:16:16",
                    "costTime": 25
                },
                {
                    "createBy": null,
                    "createTime": null,
                    "updateBy": null,
                    "updateTime": null,
                    "remark": null,
                    "operId": 4508,
                    "title": "代码生成",
                    "businessType": 8,
                    "businessTypes": null,
                    "method": "com.ruoyi.project.tool.gen.controller.GenController.batchGenCode()",
                    "requestMethod": "GET",
                    "operatorType": 1,
                    "operName": "admin",
                    "deptName": "研发部门",
                    "operUrl": "/tool/gen/batchGenCode",
                    "operIp": "14.117.134.113",
                    "operLocation": "广东省 江门市",
                    "operParam": "{\"tables\":\"sys_dept\"}",
                    "jsonResult": null,
                    "status": 0,
                    "errorMsg": null,
                    "operTime": "2024-08-02 19:00:11",
                    "costTime": 22
                },
                {
                    "createBy": null,
                    "createTime": null,
                    "updateBy": null,
                    "updateTime": null,
                    "remark": null,
                    "operId": 4507,
                    "title": "代码生成",
                    "businessType": 8,
                    "businessTypes": null,
                    "method": "com.ruoyi.project.tool.gen.controller.GenController.batchGenCode()",
                    "requestMethod": "GET",
                    "operatorType": 1,
                    "operName": "admin",
                    "deptName": "研发部门",
                    "operUrl": "/tool/gen/batchGenCode",
                    "operIp": "14.212.20.143",
                    "operLocation": "广东省 佛山市",
                    "operParam": "{\"tables\":\"sys_dept\"}",
                    "jsonResult": null,
                    "status": 0,
                    "errorMsg": null,
                    "operTime": "2024-08-02 17:56:56",
                    "costTime": 21
                },
                {
                    "createBy": null,
                    "createTime": null,
                    "updateBy": null,
                    "updateTime": null,
                    "remark": null,
                    "operId": 4506,
                    "title": "代码生成",
                    "businessType": 2,
                    "businessTypes": null,
                    "method": "com.ruoyi.project.tool.gen.controller.GenController.synchDb()",
                    "requestMethod": "GET",
                    "operatorType": 1,
                    "operName": "admin",
                    "deptName": "研发部门",
                    "operUrl": "/tool/gen/synchDb/sys_dept",
                    "operIp": "14.212.20.143",
                    "operLocation": "广东省 佛山市",
                    "operParam": "{}",
                    "jsonResult": "{\"msg\":\"操作成功\",\"code\":200}",
                    "status": 0,
                    "errorMsg": null,
                    "operTime": "2024-08-02 17:56:53",
                    "costTime": 24
                }
            ],
            "code": 200,
            "msg": "查询成功"
        });
    } catch (err) {
        res.createResponse(500, err.message);
    }
});



router.get('/operlogListQuery', validateChecks([
  
]), async function (req, res, next) {
   
    try {
        res.createResponse(200, '操作成功',
            {
                "total": 190073,
                "rows": [
                    {
                        "createBy": null,
                        "createTime": null,
                        "updateBy": null,
                        "updateTime": null,
                        "remark": null,
                        "infoId": 190172,
                        "userName": "admin",
                        "status": "0",
                        "ipaddr": "223.104.195.228",
                        "loginLocation": "山东省 泰安市",
                        "browser": "Chrome 12",
                        "os": "Windows 10",
                        "msg": "登录成功",
                        "loginTime": "2024-08-02 21:03:37"
                    },
                    {
                        "createBy": null,
                        "createTime": null,
                        "updateBy": null,
                        "updateTime": null,
                        "remark": null,
                        "infoId": 190171,
                        "userName": "admin",
                        "status": "0",
                        "ipaddr": "5.195.212.196",
                        "loginLocation": " ",
                        "browser": "Chrome 12",
                        "os": "Mac OS X",
                        "msg": "登录成功",
                        "loginTime": "2024-08-02 21:03:31"
                    },
                    {
                        "createBy": null,
                        "createTime": null,
                        "updateBy": null,
                        "updateTime": null,
                        "remark": null,
                        "infoId": 190170,
                        "userName": "admin",
                        "status": "0",
                        "ipaddr": "117.61.6.98",
                        "loginLocation": "四川省 成都市",
                        "browser": "Chrome 12",
                        "os": "Windows 10",
                        "msg": "登录成功",
                        "loginTime": "2024-08-02 21:03:22"
                    },
                    {
                        "createBy": null,
                        "createTime": null,
                        "updateBy": null,
                        "updateTime": null,
                        "remark": null,
                        "infoId": 190169,
                        "userName": "admin",
                        "status": "1",
                        "ipaddr": "117.61.6.98",
                        "loginLocation": "四川省 成都市",
                        "browser": "Chrome 12",
                        "os": "Windows 10",
                        "msg": "验证码错误",
                        "loginTime": "2024-08-02 21:03:17"
                    },
                    {
                        "createBy": null,
                        "createTime": null,
                        "updateBy": null,
                        "updateTime": null,
                        "remark": null,
                        "infoId": 190168,
                        "userName": "admin",
                        "status": "0",
                        "ipaddr": "39.171.185.121",
                        "loginLocation": "浙江省 绍兴市",
                        "browser": "Chrome 12",
                        "os": "Mac OS X",
                        "msg": "登录成功",
                        "loginTime": "2024-08-02 21:02:57"
                    },
                    {
                        "createBy": null,
                        "createTime": null,
                        "updateBy": null,
                        "updateTime": null,
                        "remark": null,
                        "infoId": 190167,
                        "userName": "admin",
                        "status": "0",
                        "ipaddr": "58.208.157.95",
                        "loginLocation": "江苏省 苏州市",
                        "browser": "Chrome 12",
                        "os": "Windows 10",
                        "msg": "登录成功",
                        "loginTime": "2024-08-02 21:02:40"
                    },
                    {
                        "createBy": null,
                        "createTime": null,
                        "updateBy": null,
                        "updateTime": null,
                        "remark": null,
                        "infoId": 190166,
                        "userName": "admin",
                        "status": "0",
                        "ipaddr": "120.245.22.90",
                        "loginLocation": "北京市 北京市",
                        "browser": "Chrome 12",
                        "os": "Windows 10",
                        "msg": "登录成功",
                        "loginTime": "2024-08-02 21:01:38"
                    },
                    {
                        "createBy": null,
                        "createTime": null,
                        "updateBy": null,
                        "updateTime": null,
                        "remark": null,
                        "infoId": 190165,
                        "userName": "admin",
                        "status": "0",
                        "ipaddr": "111.121.63.195",
                        "loginLocation": "贵州省 贵阳市",
                        "browser": "Chrome Mobile",
                        "os": "Android 6.x",
                        "msg": "登录成功",
                        "loginTime": "2024-08-02 21:01:33"
                    },
                    {
                        "createBy": null,
                        "createTime": null,
                        "updateBy": null,
                        "updateTime": null,
                        "remark": null,
                        "infoId": 190164,
                        "userName": "admin",
                        "status": "0",
                        "ipaddr": "183.94.132.127",
                        "loginLocation": "湖北省 武汉市",
                        "browser": "Chrome 12",
                        "os": "Windows 10",
                        "msg": "登录成功",
                        "loginTime": "2024-08-02 21:01:08"
                    },
                    {
                        "createBy": null,
                        "createTime": null,
                        "updateBy": null,
                        "updateTime": null,
                        "remark": null,
                        "infoId": 190163,
                        "userName": "admin",
                        "status": "0",
                        "ipaddr": "36.5.155.22",
                        "loginLocation": "安徽省 合肥市",
                        "browser": "Chrome 12",
                        "os": "Windows 10",
                        "msg": "登录成功",
                        "loginTime": "2024-08-02 20:59:51"
                    }
                ],
                "code": 200,
                "msg": "查询成功"
            }
            );
    } catch (err) {
        res.createResponse(500, err.message);
    }
});






router.get('/loginLogList', validateChecks([
  
]), async function (req, res, next) {
   
    try {
        res.createResponse(200, '操作成功',
            {
                "total": 190073,
                "rows": [
                    {
                        "createBy": null,
                        "createTime": null,
                        "updateBy": null,
                        "updateTime": null,
                        "remark": null,
                        "infoId": 190172,
                        "userName": "admin",
                        "status": "0",
                        "ipaddr": "223.104.195.228",
                        "loginLocation": "山东省 泰安市",
                        "browser": "Chrome 12",
                        "os": "Windows 10",
                        "msg": "登录成功",
                        "loginTime": "2024-08-02 21:03:37"
                    },
                    {
                        "createBy": null,
                        "createTime": null,
                        "updateBy": null,
                        "updateTime": null,
                        "remark": null,
                        "infoId": 190171,
                        "userName": "admin",
                        "status": "0",
                        "ipaddr": "5.195.212.196",
                        "loginLocation": " ",
                        "browser": "Chrome 12",
                        "os": "Mac OS X",
                        "msg": "登录成功",
                        "loginTime": "2024-08-02 21:03:31"
                    },
                    {
                        "createBy": null,
                        "createTime": null,
                        "updateBy": null,
                        "updateTime": null,
                        "remark": null,
                        "infoId": 190170,
                        "userName": "admin",
                        "status": "0",
                        "ipaddr": "117.61.6.98",
                        "loginLocation": "四川省 成都市",
                        "browser": "Chrome 12",
                        "os": "Windows 10",
                        "msg": "登录成功",
                        "loginTime": "2024-08-02 21:03:22"
                    },
                    {
                        "createBy": null,
                        "createTime": null,
                        "updateBy": null,
                        "updateTime": null,
                        "remark": null,
                        "infoId": 190169,
                        "userName": "admin",
                        "status": "1",
                        "ipaddr": "117.61.6.98",
                        "loginLocation": "四川省 成都市",
                        "browser": "Chrome 12",
                        "os": "Windows 10",
                        "msg": "验证码错误",
                        "loginTime": "2024-08-02 21:03:17"
                    },
                    {
                        "createBy": null,
                        "createTime": null,
                        "updateBy": null,
                        "updateTime": null,
                        "remark": null,
                        "infoId": 190168,
                        "userName": "admin",
                        "status": "0",
                        "ipaddr": "39.171.185.121",
                        "loginLocation": "浙江省 绍兴市",
                        "browser": "Chrome 12",
                        "os": "Mac OS X",
                        "msg": "登录成功",
                        "loginTime": "2024-08-02 21:02:57"
                    },
                    {
                        "createBy": null,
                        "createTime": null,
                        "updateBy": null,
                        "updateTime": null,
                        "remark": null,
                        "infoId": 190167,
                        "userName": "admin",
                        "status": "0",
                        "ipaddr": "58.208.157.95",
                        "loginLocation": "江苏省 苏州市",
                        "browser": "Chrome 12",
                        "os": "Windows 10",
                        "msg": "登录成功",
                        "loginTime": "2024-08-02 21:02:40"
                    },
                    {
                        "createBy": null,
                        "createTime": null,
                        "updateBy": null,
                        "updateTime": null,
                        "remark": null,
                        "infoId": 190166,
                        "userName": "admin",
                        "status": "0",
                        "ipaddr": "120.245.22.90",
                        "loginLocation": "北京市 北京市",
                        "browser": "Chrome 12",
                        "os": "Windows 10",
                        "msg": "登录成功",
                        "loginTime": "2024-08-02 21:01:38"
                    },
                    {
                        "createBy": null,
                        "createTime": null,
                        "updateBy": null,
                        "updateTime": null,
                        "remark": null,
                        "infoId": 190165,
                        "userName": "admin",
                        "status": "0",
                        "ipaddr": "111.121.63.195",
                        "loginLocation": "贵州省 贵阳市",
                        "browser": "Chrome Mobile",
                        "os": "Android 6.x",
                        "msg": "登录成功",
                        "loginTime": "2024-08-02 21:01:33"
                    },
                    {
                        "createBy": null,
                        "createTime": null,
                        "updateBy": null,
                        "updateTime": null,
                        "remark": null,
                        "infoId": 190164,
                        "userName": "admin",
                        "status": "0",
                        "ipaddr": "183.94.132.127",
                        "loginLocation": "湖北省 武汉市",
                        "browser": "Chrome 12",
                        "os": "Windows 10",
                        "msg": "登录成功",
                        "loginTime": "2024-08-02 21:01:08"
                    },
                    {
                        "createBy": null,
                        "createTime": null,
                        "updateBy": null,
                        "updateTime": null,
                        "remark": null,
                        "infoId": 190163,
                        "userName": "admin",
                        "status": "0",
                        "ipaddr": "36.5.155.22",
                        "loginLocation": "安徽省 合肥市",
                        "browser": "Chrome 12",
                        "os": "Windows 10",
                        "msg": "登录成功",
                        "loginTime": "2024-08-02 20:59:51"
                    }
                ],
                "code": 200,
                "msg": "查询成功"
            }
            );
    } catch (err) {
        res.createResponse(500, err.message);
    }
});

module.exports = router;